/*
 * COPYRIGHT. ShenZhen iByte Technology Co., Ltd. 2018.
 * ALL RIGHTS RESERVED.
 *
 * No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
 * on any form or by any means, electronic, mechanical, photocopying, recording, 
 * or otherwise, without the prior written permission of ShenZhen iByte Network Technology Co., Ltd.
 *
 * Amendment History:
 * 
 * Date                   By              Description
 * -------------------    -----------     -------------------------------------------
 * Nov 30, 2018    Li.shangzhi         Create the class
 */
package com.github.icloud.elasticsearch.api.query;
import static org.elasticsearch.index.query.QueryBuilders.commonTermsQuery;
import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
import static org.elasticsearch.index.query.QueryBuilders.multiMatchQuery;
import org.elasticsearch.index.query.QueryBuilder;
import org.junit.Test;
import com.github.icloud.elasticsearch.ElasticsearchClientBase;
/**
 * @FileName FullTestQueries.java
 * @Description: 全文搜索
 *
 * @Date Nov 30, 2018 8:18:51 PM
 * @author Li.shangzhi
 * @version 1.0
 */
public class FullTestQueries extends ElasticsearchClientBase{

	@Test
	public void iEsMatchQuery() throws Exception{
		QueryBuilder qb = matchQuery(
				"message", //field 字段
				"alarm"    // text
				);
		iEsPrepareSearch(qb);
	}

	@Test
	public void iEsMultiMatchQuery() throws Exception {
		QueryBuilder qb = multiMatchQuery(
				"Elasticsearch", 		// text
				"user", "message","postDate"    //fields 多个字段
				);
		iEsPrepareSearch(qb);

	}
	
	/***
	 * @Title: iEsCommonTermsQuery 
	 * @Description:测试未通过，详细分析查看API
	 * @throws Exception 
	 * @author Li.shangzhi
	 * @date Dec 3, 2018 10:46:15 AM
	 */
	@Test
	public void iEsCommonTermsQuery() throws Exception {
		QueryBuilder qb = commonTermsQuery(
				"message",     //field 字段
				"trying out Elasticsearch");  	// value
		iEsPrepareSearch(qb);
	}

}
